Next | Prev | Up | Top | Contents | Index

Issuing a Request With doscsireq()

The doscsireq() function issues a SCSI request by passing a dsreq to the SCSI device driver using an ioctl() call. The dsreq must have been prepared completely beforehand. The function prototype is

int doscsireq(int fd, struct dsreq *dsp);

The arguments are as follows:

fd The file descriptor for the open device file.
dsp The address of the dsreq prepared by dsopen().

Normally the returned value is the SCSI status byte. When the requested operation ends with Busy or Reserve Conflict status, the function sleeps 2 seconds and tries the operation up to four times. The returned value is -1 when the device driver rejects the ioctl() or the third retry ends in failure.


Next | Prev | Up | Top | Contents | Index